﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Telerik.OpenAccess;

namespace LINQPad.OpenAccess.Metadata.Reflection
{
    /// <summary>
    /// Reflection services.
    /// </summary>
    public interface IReflectionService
    {
        #region - Functions

        /// <summary>
        /// Gets the context types from the specified assembly.
        /// </summary>
        /// <param name="assembly">The assembly.</param>
        /// <returns>
        /// The context types.
        /// </returns>
        IEnumerable<Type> GetContextTypesFromAssembly( Assembly assembly );
        /// <summary>
        /// Gets the entity sets from context the specified context.
        /// </summary>
        /// <param name="contextType">Type of the context.</param>
        /// <returns>
        /// The entity sets.
        /// </returns>
        IEnumerable<EntitySetInfo> GetEntitySetsFromContext( Type contextType );
        /// <summary>
        /// Gets the metadata source types from assembly.
        /// </summary>
        /// <param name="assembly">The assembly.</param>
        /// <returns>
        /// The metadata source types.
        /// </returns>
        IEnumerable<Type> GetMetadataSourceTypesFromAssembly( Assembly assembly );
        /// <summary>
        /// Determines whether the specified type is an open access context type.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns>
        ///   <c>true</c> if the specified type is an open access context type; otherwise, <c>false</c>.
        /// </returns>
        bool IsContextType( Type type );
        /// <summary>
        /// Determines whether the specified property is an entity set.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <returns>
        ///   <c>true</c> if the specified property is an entity set; otherwise, <c>false</c>.
        /// </returns>
        bool IsEntitySetProperty( PropertyInfo property );
        /// <summary>
        /// Determines whether the specified type is a metadata source type.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns>
        ///   <c>true</c> if the specified type is a metadata source type; otherwise, <c>false</c>.
        /// </returns>
        bool IsMetadataSourceType( Type type );

        #endregion

    }
}
